package org.studiox.graph.runtime.config;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import org.springdoc.core.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class Swagger3Config {

  @Bean
  public OpenAPI graphOpenApi() {
    return new OpenAPI()
        .info(
            new Info()
                .title("Studiox Graph Runtime OpenAPI Docs")
                .description("REST API powered by OpenAPI v3.0 (Swagger3)")
                .version("1.0.0-SNAPSHOT"));
  }

  @Bean
  public GroupedOpenApi systemApi() {
    return GroupedOpenApi.builder()
        .group("system")
        .pathsToMatch("/studiox/api/graph/runtime/v1/system/**")
        .build();
  }

  @Bean
  public GroupedOpenApi graphApi() {
    return GroupedOpenApi.builder()
        .group("graph")
        .pathsToMatch("/studiox/api/graph/runtime/v1/graph/**")
        .build();
  }

  @Bean
  public GroupedOpenApi lineageApi() {
    return GroupedOpenApi.builder()
        .group("lineage")
        .pathsToMatch("/studiox/api/graph/runtime/v1/lineage/**")
        .build();
  }
}
